#include "login.h"
#include "database.h"

#include <QApplication>
#include <QDesktopWidget>
#include <QMessageBox>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Login w;
    if (!Database::connect())
    {
        QMessageBox::warning(&w, "错误", "数据库连接失败请确保安装了sqlite");
    }
    QDesktopWidget *desktop = QApplication::desktop();
    int screenWidth = desktop->width();
    int screenHeight = desktop->height();

    // 计算弹窗的中心位置
    int x = (screenWidth - w.width()) / 2;
    int y = (screenHeight - w.height()) / 2;
    w.move(x,y);
    w.show();
    return a.exec();
}
